//package com.github.prontera.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.dao.EmptyResultDataAccessException;
//import org.springframework.stereotype.Component;
//
//import com.github.prontera.domain.Sequence;
//import com.github.prontera.service.SequenceService;
//
//@Component
//public class IdentifierApiService {
//
//	@Autowired
//	private SequenceService sequenceService;
//
//	
//	/**
//	 * 每天创建客户端(Client)ID
//	 */
//	public void initClientIdentifier(String name) {
//		Sequence sequence = new Sequence();
//		sequence.setCurrentValue(10000000l);
//		sequence.setIncrement(1);
//		sequence.setMaxValue(Long.MAX_VALUE);
//		sequence.setName(name);
//		sequence.setThreshold(8);
//		sequence.setTotal(20);
//		sequenceService.insert(sequence);
//	}
//
//	/**
//	 * 客户端(Client)ID
//	 */
//	public Long getTalendOrderNo() {
//		try {
//			return sequenceService.next("TALEND_ORDER_NO" );
//		} catch (EmptyResultDataAccessException e) {
//			e.printStackTrace();
//			initClientIdentifier("TALEND_ORDER_NO");
//		}
//		return sequenceService.next("TALEND_ORDER_NO" );
//	}
//	
//	/**
//	 * 客户端(Client)ID
//	 */
//	public Long getClientIdentifier() {
//		try {
//			return sequenceService.next("CLIENT_IDENTIFIER" );
//		} catch (EmptyResultDataAccessException e) {
//			e.printStackTrace();
//			initClientIdentifier("CLIENT_IDENTIFIER");
//		}
//		return sequenceService.next("CLIENT_IDENTIFIER" );
//	}
//	
//}
